<template>
    <div class="sidebar_box">
        <router-link to="/firstpage"><p class="title">首页</p></router-link>
       <el-tree :data="data"  @node-click="handleNodeClick"></el-tree> 
    </div>
</template>

<script>
export default {
    data() {
      return {
        data: [{
          label: '账号设置',
          children: [{
            label: '账号信息',
            to:'/main/userinfo'
          },{
            label: '修改密码',
            to:'/main/recover'
          }]
        }, {
          label: '商品管理',
          children: [{
            label: '商品列表',
            to:'/main/goodslist'
          }]
        }, {
          label: '订单管理',
          children: [{
            label: '订单列表',
            to:'/main/orderlist'
          }]
        }],
      };
    },
    methods: {
      handleNodeClick(obj) {
        if(obj.to){
            this.$router.push({path:obj.to})
        }
      }
    }
};

</script>

<style lang="scss" scoped>
.sidebar_box{
    a{
        text-decoration: none;
    }

    .title{
        color: rgb(106, 105, 105);
        margin-top: 15px;
        font-weight: 500;
        margin-bottom: 15px;
        font-size: 15px;
        text-align: center;
    }

}
</style>

